<?php
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

class m_konten_statis extends CI_Model
{
    
    public function __construct() {
        parent::__construct();
    }
    
    function get() {
        $sql = 'SELECT * FROM konten_statis 
        WHERE id_konten_statis IN (1,2,3,4,5,6)
        ORDER BY nama';
        return $sql;
    }
    
    function get_cari($keyword = '') {
        $sql = 'SELECT * FROM konten_statis
        WHERE judul LIKE "%' . $keyword . '%"
        AND id_konten_statis IN (1,2,3,4,5,6)';
        return $sql;
    }
    
    function get_by($params) {
        $sql = 'SELECT * FROM konten_statis  
        WHERE id_konten_statis = ?';
        $query = $this->db->query($sql, $params);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();
            $query->free_result();
        } else {
            $result = array();
        }
        return $result;
    }
    
    function update($id_konten_statis, $dataUpdate) {
        $this->db->where('id_konten_statis', $id_konten_statis);
        $update = $this->db->update('konten_statis', $dataUpdate);
        return $update;
    }
    
    function delete($id_faq) {
        $this->db->where('id_faq', $id_faq);
        $delete = $this->db->delete('faq');
        return $delete;
    }
}
